package com.cheri.keller.common.Strategy;

import com.cheri.keller.common.util.QiniuUtils;
import com.qiniu.common.QiniuException;
import com.qiniu.http.Response;
import org.springframework.web.multipart.MultipartFile;

import java.io.FileInputStream;
import java.io.IOException;

public class UploadFileQiniuStrategy implements UploadFileStrategy {


    @Override
    public String UploadFile(MultipartFile multipartFile) throws IOException {


        FileInputStream fileInputStream = (FileInputStream) multipartFile.getInputStream();

        return QiniuUtils.uploadQNImg(fileInputStream, null);//key null 七牛云自动生成文件名;
    }

    @Override
    public Response deleFileByName(String imgName) throws QiniuException {

        return  QiniuUtils.deleFileByName(imgName);
    }
}
